/*******************************************************************************
 * Copyright 2020 huanggefan.cn
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 ******************************************************************************/

package models

type Resource struct {
	UUID        string  `gorm:"not null; primaryKey; type:uuid; default:gen_random_uuid()"`
	ChapterUUID string  `gorm:"not null"`
	Chapter     Chapter `gorm:"foreignKey:ChapterUUID; references:UUID; constraint:OnUpdate:CASCADE,OnDelete:CASCADE"`
	Prefix      string  `gorm:"not null; type:char(3)"`
	StoreName   string  `gorm:"not null; type:char(40)"`
	FileName    string  `gorm:"not null; type:varchar(99)"`
	FileType    int     `gorm:"not null; type:integer"`
	PutUserUUID string  `gorm:"not null"`
	PutUser     User    `gorm:"foreignKey:PutUserUUID; references:AccountID; constraint:OnUpdate:CASCADE,OnDelete:CASCADE"`
}
